{% load staticfiles %}

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Dashboard &mdash; Stisla</title>


    <link rel="stylesheet" href="{% static 'fourm/modules/bootstrap/css/bootstrap.min.css' %}">

  <link rel="stylesheet" href="{% static 'fourm/modules/ionicons/css/ionicons.min.css' %}">
  <link rel="stylesheet" href="{% static 'fourm/modules/fontawesome/web-fonts-with-css/css/fontawesome-all.min.css' %}">

  <link rel="stylesheet" href="{% static 'fourm/modules/summernote/summernote-lite.css' %}">
  <link rel="stylesheet" href="{% static 'fourm/modules/flag-icon-css/css/flag-icon.min.css' %}">
  <link rel="stylesheet" href="{% static 'fourm/css/demo.css' %}">
  <link rel="stylesheet" href="{% static 'fourm/css/style.css' %}">
    <link rel="stylesheet" href="{% static 'fourm/css/demo1.css' %}">
</head>

<body style="overflow-x: hidden;" >
  <div id="app">
    <div class="main-wrapper" >
      <div class="navbar-bg"></div>
      <nav class="navbar navbar-expand-lg main-navbar" id="nav_box">
        <form class="form-inline mr-auto">
          <ul class="navbar-nav mr-3" onclick="navbar_display();">
            <li><a href="javascript:;"  data-toggle="sidebar" class="nav-link nav-link-lg"><i class="ion ion-navicon-round" ></i></a></li>
            <li><a href="javascript:;"  data-toggle="search" class="nav-link nav-link-lg d-sm-none"><i class="ion ion-search" ></i></a></li>
          </ul>
          <div class="search-element">
            <input class="form-control" type="search" placeholder="Search" aria-label="Search">
            <button class="btn" type="submit"><i class="ion ion-search"></i></button>
          </div>
        </form>
        <ul class="navbar-nav navbar-right">
          <li class="dropdown dropdown-list-toggle"><a href="#" data-toggle="dropdown" class="nav-link notification-toggle nav-link-lg beep"><i class="ion ion-ios-bell-outline"></i></a>
            <div class="dropdown-menu dropdown-list dropdown-menu-right">
              <div class="dropdown-header">Notifications
                <div class="float-right">
                  <a href="#">View All</a>
                </div>
              </div>
              <div class="dropdown-list-content">
                <a href="#" class="dropdown-item dropdown-item-unread">
                  <img alt="image" src="{% static 'fourm/img/avatar/avatar-1.jpeg' %}" class="rounded-circle dropdown-item-img">
                  <div class="dropdown-item-desc">
                    <b>Kusnaedi</b> has moved task <b>Fix bug header</b> to <b>Done</b>
                    <div class="time">10 Hours Ago</div>
                  </div>
                </a>
                <a href="#" class="dropdown-item dropdown-item-unread">
                  <img alt="image" src="{% static 'fourm/img/avatar/avatar-2.jpeg' %}" class="rounded-circle dropdown-item-img">
                  <div class="dropdown-item-desc">
                    <b>Ujang Maman</b> has moved task <b>Fix bug footer</b> to <b>Progress</b>
                    <div class="time">12 Hours Ago</div>
                  </div>
                </a>
                <a href="#" class="dropdown-item">
                  <img alt="image" src="{% static 'fourm/img/avatar/avatar-3.jpeg' %}" class="rounded-circle dropdown-item-img">
                  <div class="dropdown-item-desc">
                    <b>Agung Ardiansyah</b> has moved task <b>Fix bug sidebar</b> to <b>Done</b>
                    <div class="time">12 Hours Ago</div>
                  </div>
                </a>
                <a href="#" class="dropdown-item">
                  <img alt="image" src="{% static 'fourm/img/avatar/avatar-4.jpeg' %}" class="rounded-circle dropdown-item-img">
                  <div class="dropdown-item-desc">
                    <b>Ardian Rahardiansyah</b> has moved task <b>Fix bug navbar</b> to <b>Done</b>
                    <div class="time">16 Hours Ago</div>
                  </div>
                </a>
                <a href="#" class="dropdown-item">
                  <img alt="image" src="{% static 'fourm/img/avatar/avatar-5.jpeg' %}" class="rounded-circle dropdown-item-img">
                  <div class="dropdown-item-desc">
                    <b>Alfa Zulkarnain</b> has moved task <b>Add logo</b> to <b>Done</b>
                    <div class="time">Yesterday</div>
                  </div>
                </a>
              </div>
            </div>
          </li>
          <li class="dropdown"><a href="#" data-toggle="dropdown" class="nav-link dropdown-toggle nav-link-lg">
            <i class="ion ion-android-person d-lg-none"></i>
            <div class="d-sm-none d-lg-inline-block">{{ request.session.user_name }}</div></a>
            <div class="dropdown-menu dropdown-menu-right">
              <a href="profile.html" class="dropdown-item has-icon">
                <i class="ion ion-android-person"></i> Profile
              </a>
              <a href="#" class="dropdown-item has-icon">
                <i class="ion ion-log-out"></i> Logout
              </a>
            </div>
          </li>
        </ul>
      </nav>
      <div class="main-sidebar" id="main_sidebar_box" >
        <aside id="sidebar-wrapper" >
            <a href="javascript:;" id="none_box" onclick="navbar_display_none()">x</a>
          <div class="sidebar-brand">
            <a href="index.html">Stisla Lite</a>
          </div>
          <div class="sidebar-user">
            <div class="sidebar-user-picture">
              <img alt="image" src="{% static 'fourm/img/avatar/avatar-1.jpeg' %}">
            </div>
            <div class="sidebar-user-details">
              <div class="user-name">{{ request.session.user_name }}</div>
              <div class="user-role">
                管理员
              </div>
            </div>
          </div>
          <ul class="sidebar-menu">
            <li class="menu-header">控制台</li>
            <li class="active">
              <a href="index.html"><i class="ion ion-speedometer"></i><span>当前数据</span></a>
            </li>

            <li class="menu-header">部件</li>
            <li>
              <a href="https://blog.csdn.net/weixin_43898067" class="has-dropdown"><i class="ion ion-ios-albums-outline"></i><span>架构</span></a>
              <ul class="menu-dropdown">
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Basic</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Main Components</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Buttons</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Toastr</a></li>
              </ul>
            </li>
            <li>
              <a href="#" class="has-dropdown"><i class="ion ion-flag"></i><span>标记</span></a>
              <ul class="menu-dropdown">
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Ion Icons</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Font Awesome</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Flag</a></li>
              </ul>
            </li>
            <li>
              <a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-clipboard"></i><span>历史操作</span></a>
            </li>
            <li>
              <a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-stats-bars"></i><span>图表</span></a>
            </li>
            <li>
              <a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-location-outline"></i><span>地图</span></a>
            </li>
            <li>
              <a href="#" class="has-dropdown"><i class="ion ion-ios-copy-outline"></i><span>实例</span></a>
              <ul class="menu-dropdown">
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Login</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Register</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Forgot Password</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Reset Password</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> 404</a></li>
              </ul>
            </li>

            <li class="menu-header">More</li>
            <li>
              <a href="https://blog.csdn.net/weixin_43898067" class="has-dropdown"><i class="ion ion-ios-nutrition"></i> 关注我</a>
              <ul class="menu-dropdown">
                <li><a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-circle-outline"></i> Menu 1</a></li>
                <li><a href="https://blog.csdn.net/weixin_43898067" class="has-dropdown"><i class="ion ion-ios-circle-outline"></i> Menu 2</a>
                  <ul class="menu-dropdown">
                    <li><a href="#"><i class="ion ion-ios-circle-outline"></i> Child Menu 1</a></li>
                    <li><a href="#"><i class="ion ion-ios-circle-outline"></i> Child Menu 2</a></li>
                    <li><a href="#" class="has-dropdown"><i class="ion ion-ios-circle-outline"></i> Child Menu 3</a>
                      <ul class="menu-dropdown">
                        <li><a href="#"><i class="ion ion-ios-circle-outline"></i> Child Menu 1</a></li>
                        <li><a href="#"><i class="ion ion-ios-circle-outline"></i> Child Menu 2</a></li>
                        <li><a href="#"><i class="ion ion-ios-circle-outline"></i> Child Menu 3</a></li>
                      </ul>
                    </li>
                    <li><a href="#"><i class="ion ion-ios-circle-outline"></i> Child Menu 4</a></li>
                  </ul>
                </li>
              </ul>
            </li>
            <li>
              <a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-heart"></i> 点赞 <div class="badge badge-primary">10</div></a>
            </li>
            <li>
              <a href="https://blog.csdn.net/weixin_43898067"><i class="ion ion-ios-information-outline"></i> <Credits>详情</Credits></a>
            </li>          </ul>
          <div class="p-3 mt-4 mb-4">
            <a href="#" class="btn btn-danger btn-shadow btn-round has-icon has-icon-nofloat btn-block">
              <i class="ion ion-help-buoy"></i> <div>Go PRO!</div>
            </a>
          </div>
        </aside>
      </div>
      <div class="main-content" id="main_context_box">
        <section class="section">
          <h1 class="section-header">
            <div>监控平台</div>
          </h1>
          <div class="row">
            <div class="col-lg-3 col-md-6 col-12">
              <div class="card card-sm-3">
                <div class="card-icon bg-primary">
                  <i class="ion ion-person"></i>
                </div>
                <div class="card-wrap">
                  <div class="card-header">
                    <h4>实时人员</h4>
                  </div>
                  <div class="card-body">
{#                  <h5>{{  battery }}</h5>#}
                      69
                  </div>
                </div>
              </div>
            </div>
            <div class="col-lg-3 col-md-6 col-12">
              <div class="card card-sm-3">
                <div class="card-icon bg-danger">
                  <i class="ion ion-ios-paper-outline"></i>
                </div>
                <div class="card-wrap">
                  <div class="card-header">
                    <h4>温度</h4>
                  </div>
                  <div class="card-body"  >
                      28
                      {#<h5>{{  temperature }}</h5>#}
                  </div>
                </div>
              </div>
            </div>
            <div class="col-lg-3 col-md-6 col-12">
              <div class="card card-sm-3">
                <div class="card-icon bg-warning">
                  <i class="ion ion-paper-airplane"></i>
                </div>
                <div class="card-wrap">
                  <div class="card-header">
                    <h4>湿度</h4>
                  </div>
                  <div class="card-body">
                      41
{#                     <h5>{{  humidity }}</h5>#}
                  </div>
                </div>
              </div>
            </div>
            <div class="col-lg-3 col-md-6 col-12" >
              <div class="card card-sm-3">
                <div class="card-icon bg-success">
                  <i class="ion ion-record"></i>
                </div>
                <div class="card-wrap">
                  <div class="card-header">
                    <h4>电量提醒</h4>
                  </div>
                  <div class="card-body">

                    30
                  </div>
                </div>
              </div>
            </div>                  
          </div>
          <div class="row">
            <div class="col-lg-8 col-md-12 col-12 col-sm-12">
              <div class="card">
                <div class="card-header">
                  <div class="float-right">
                    <div class="btn-group">
                      <a href="javascript:;" onclick="toPage('Week')" class="btn active">实时人员</a>
                      <a href="javascript:;" onclick="toPage('Month')" class="btn " >温度</a>
                      <a href="javascript:;" onclick="toPage('Year')" class="btn " >湿度</a>
                    </div>
                  </div>
                  <h4>人流分析</h4>
                </div>
                <iframe name="main_iframe" id="main_iframe" height="780px" style="border:none;" scrolling="no"
                        src="{% static 'templates/Week.html' %}"></iframe>
              </div>
            </div>
            <div class="col-lg-4 col-md-12 col-12 col-sm-12">
              <div class="card">
                <div class="card-header">
                  <h4>AI预测</h4>
                </div>
                <div class="card-body">             
                  <ul class="list-unstyled list-unstyled-border">
                    <li class="media">
                      <img class="mr-3 rounded-circle" width="50" src="{% static 'fourm/img/avatar/avatar-1.jpeg' %}" alt="avatar">
                      <div class="media-body">
                        <div class="float-right"><small>机器学习ing...</small></div>
                        <div class="media-title">预测两小时后人数为{{  ai_str0 }}</div>
                        <small>{{  ai_str3 }}</small>
                      </div>
                    </li>
                    <li class="media">
                      <img class="mr-3 rounded-circle" width="50" src="{% static 'fourm/img/avatar/avatar-2.jpeg' %}" alt="avatar">
                      <div class="media-body">
                        <div class="float-right"><small>机器学习ing...</small></div>
                        <div class="media-title">预测两小时后温度为{{  ai_str1 }}                                   </div>
                        <small>{{  ai_str4 }} </small>
                      </div>
                    </li>
                    <li class="media">
                      <img class="mr-3 rounded-circle" width="50" src="{% static 'fourm/img/avatar/avatar-3.jpeg' %}" alt="avatar">
                      <div class="media-body">
                        <div class="float-right"><small>机器学习ing...</small></div>
                        <div class="media-title">预测两小时后湿度为{{  ai_str2 }}</div>
                        <small>{{  ai_str5 }}</small>
                      </div>
                    </li>
                    <li class="media">
                      <img class="mr-3 rounded-circle" width="50" src="{% static 'fourm/img/avatar/avatar-4.jpeg' %}" alt="avatar">
                      <div class="media-body">
                        <div class="float-right"><small>50m</small></div>
                        <div class="media-title">arm里使用mmap---＞虚拟地址映射:探究虚拟内存         </div>
                        <small>cpu操作的内存和实际内存不相同 cpu得到的是mmu分配的虚拟地址,而嵌入式操作的硬件一般都是实际的想操作物理地址–>寄存器,frameniffer...</small>
                      </div>
                    </li>
                  </ul>
                  <div class="text-center">
                    <a href="#" class="btn btn-primary btn-round" >
                      查看所有
                    </a>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="row justify-content-start">
            <div class="col-lg-5 col-md-10 col-10 col-sm-10">
              <form action="post_meaage/" method="get" class="needs-validation" novalidate>
                {% csrf_token %}
                <div class="card">
                  <div class="card-header">
                    <h4>下发命令</h4>
                  </div>
                  <div class="card-body">
                    <div class="form-group">
                      <label>命令</label>
                      <input type="text" name="command" class="form-control" required>
                      <div class="invalid-feedback">
                        Please fill in the title
                      </div>
                    </div>
                    <div class="form-group">
                     <label>参数</label>
                      <input type="text" name="arg" class="form-control" required>
                    </div>
                  </div>
                  <div class="card-footer">
                    <button class="btn btn-primary" action="login_check/" name="dire" value="0" >发送命令</button>
                  </div>
                </div>
              </form>


            </div>
              <div class="row justify-content-end">
            <div class="col-lg-12 col-md-10 col-10 col-sm-10">
                <div class="card">
                  <div class="card-header">
                    <h4>视频</h4>
                  </div>
                  <div class="card-body">
                      <img class="video_box" src=""/>
                  </div>
                </div>


            </div>



  <script src="{% static 'fourm/modules/jquery.min.js' %}"></script>
  <script src="{% static 'fourm/modules/popper.js' %}"></script>
  <script src="{% static 'fourm/modules/tooltip.js' %}"></script>
  <script src="{% static 'fourm/modules/bootstrap/js/bootstrap.min.js' %}"></script>
  <script src="{% static 'fourm/modules/nicescroll/jquery.nicescroll.min.js' %}"></script>
  <script src="{% static 'fourm/modules/scroll-up-bar/dist/scroll-up-bar.min.js' %}"></script>
  <script src="{% static 'fourm/js/sa-functions.js' %}"></script>
  
  <script src="{% static 'fourm/modules/summernote/summernote-lite.js' %}"></script>
  <script src="{% static 'fourm/js/demo1.js' %}"></script>

  <script>
          var context_time={{ time }};
          var context_wendu={{ wendu }};
          var context_shidu={{ shidu }};
          var context_renshu={{ renshu }};
  function toPage(page){
      var frameSrc=document.querySelector("#main_iframe");
      var attr=document.querySelectorAll(".btn-group > .btn");
      for(var i=0;i<attr.length;i++){
          attr[i].classList.remove("active");
      }
      if(page=='Week'){
          frameSrc.src="{% static 'templates/Week.html' %}";
          attr[0].classList.add("active");
          attr[1].removeAttribute("style");
          attr[2].removeAttribute("style");
      }else if(page=='Month'){
          frameSrc.src="{% static 'templates/Month.html' %}";
          attr[1].setAttribute("style","background-color: #dc3545 !important;color: #fff;");
          attr[2].removeAttribute("style");
      }else if(page=='Year'){
          frameSrc.src="{% static 'templates/Year.html' %}";
          attr[1].removeAttribute("style");
          attr[2].setAttribute("style","background-color: #ffc107 !important;color: #fff;");
      }
  }

  //img动态读取图片
      $(document).ready(function(){
         changeImg(".video_box");
      });
        function changeImg(id){
            var imgname = ".././static/fourm/video_img/AAA.jpg";//假设图片都是以这个开头，后面对应数字。
                num = 0,
                //type = ".jpg",
                ele = document.querySelector(id);//假设这是需要改变的img的元素的类选择器
            function changeImgSrc(){
                num = num ==4?0:num+1;
                ele.src = imgname;
                setTimeout(changeImgSrc,100);
            }
            setTimeout(changeImgSrc,100);
        }
  </script>
  <script src="{% static 'fourm/js/custom.js' %}"></script>
  <script src="{% static 'fourm/js/demo.js' %}"></script>
</body>
</html>